package com.corpgovernment.common.oversea;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Arrays;

/**
 * @author ldma
 * @date 2024/1/5
 */
@Slf4j
@Component
public class OverseaCityUtils {

    @Value("${chinaCountryId:1}")
    private String chinaCountryId;
    @Value("${gATProvinceId:32,33,53}")
    private String gATProvinceId;


    /**
     * 判断是否是港澳台或海外城市
     */
    public Boolean isOverseaOrGATCity(String countryId, String provinceId) {
        if (countryId == null || provinceId == null) {
            log.info("输入参数有误: countryId={}, provinceId={}", countryId, provinceId);
            return null;
        }
        return !countryId.equals(chinaCountryId) || Arrays.asList(gATProvinceId.split(",")).contains(provinceId);
    }

}
